<?php
/**
 * beimuaihui System
 * Copyright(c) 2011-2020 beimuaihui.
 * @license    http://www.gnu.org/licenses/gpl.html     This software Under GPL V3 License 
 * beimuaihui@gmail.com
 * http://code.google.com/p/beimuaihui/
 * $Id: Controller.php 197 2011-02-18 12:45:33Z beimuaihui $
 */

class Baogg_Controller {
	
	public static function getUrlParams() {		
		$request = Zend_Controller_Front::getInstance ()->getRequest ();
		$params = $request ? $request->getParams () : $_REQUEST;
		if (! isset ( $params ['module'] )) {
			$params = array_merge ( $params, self::getCustomControllerName () );
		}
		return $params;
	}
	public static function getCustomControllerName() {
		
		$sParams = substr ( $_SERVER ['REQUEST_URI'], strlen ( BAOGG_BASE_URL ) );
		$aParams = explode ( "/", $sParams );
		$ctlName ['module'] = isset($aParams[0]) && $aParams[0]? $aParams [0] : "default";
		$ctlName ['controller'] = isset($aParams[1]) && $aParams[1]? $aParams [1] : "index";
		$ctlName ['action'] = isset($aParams[2])  && $aParams[2]? $aParams [2] : "index";
		return $ctlName;
	}
}